`11` = "Decline/not sure",
`1` = "Yes, hispanic",
`2` = "No, not hispanic")
table(survey$race1)
table(survey$race2)
survey$race <- ifelse(survey$race1 == "Refused" |
survey$race1 == "Not sure",
"Decline/not sure", ifelse(survey$race1 == "White",
ifelse(survey$race2 == "Decline/not sure",
"Decline/not sure",
ifelse(survey$race2 == "No, not hispanic",
"Non-Hispanic White",
"Hispanic White")), "Non-white"))
table(survey$race)
table(survey$race[survey$race1 == "White"])
setwd("~/Dropbox/Perception_Inequality_wHannah/Replication/Harris_Data/Harris 1998 Business Week National Issues Survey, study no. 718368")
require("dplyr")
survey <- read.table("harris_s718368_spss.tab", header = TRUE)
### fix everything below for this survey
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- "718368"
# study year (year)
survey$year <- 1998
# geographic data (urban)
table(survey$PLACE)
survey$urban <- dplyr::recode(survey$PLACE,
`1` = "Central City",
`2` = "Rest of metro area",
`3` = "Small town",
`4` = "Rural")
table(survey$urban)
# geographic data (region)
table(survey$REGION)
survey$region <- dplyr::recode(survey$REGION,
`1` = "East",
`2` = "East",
`3` = "South",
`4` = "South",
`5` = "Midwest",
`6` = "Midwest",
`7` = "West",
`8` = "West")
table(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
table(survey$Q40_B)
survey$inequality <- dplyr::recode(as.character(survey$Q40_B),
`1` = "Feel",
`2` = "Don't Feel",
`11` = "Not Sure",
`12` = "Refused")
table(survey$inequality)
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- NA
survey$union.other <- NA
# employment (employed)
survey$employed <- NA
# empl self
survey$employed.self <- NA
# occupation
survey$occupation <- NA
# occ self
survey$occupation.self <- NA
# household size (hhsize)
table(survey$Q2001)
survey$hhsize_over18 <- as.numeric(survey$Q2001)
survey$hhsize_under18 <- as.numeric(survey$Q2005)
survey$hhsize <- rowSums(survey[, c("hhsize_over18",
"hhsize_under18")],
na.rm = TRUE)
survey$hhsize[is.na(survey$hhsize_over18)] <- NA
# education (educ)
table(survey$Q2015)
survey$educ <- dplyr::recode(survey$Q2015,
`1` = "Less than high school",
`2` = "High school graduate",
`3` = "Some college",
`4` = "College graduate",
`5` = "Post graduate",
`11` = "Not sure",
`12` = "Refused")
table(survey$educ)
# household income (income)
table(survey$Q2030)
survey$income <- dplyr::recode(survey$Q2030,
`1` = "Under $7500",
`2` = "$7,501 to $15,000",
`3` = "$15,001 to $25,000",
`4` = "$25,001 to $35,000",
`5` = "$35,001 to $50,000",
`6` = "$50,001 to $75,000",
`7` = "$75,001 to $100,000",
`8` = "$100,001 or over",
`11` = "Not sure",
`12` = "Refused")
table(survey$income)
# age
table(survey$Q2010)
survey$age <- as.character(survey$Q2010)
# race
table(survey$Q2040)
survey$race1 <- dplyr::recode(survey$Q2040,
`1` = "White",
`2` = "Black",
`3` = "African-American",
`4` = "Asian or Pacific Islander",
`5` = "American Indian or Alaskan native",
`6` = "Some other race",
`11` = "Not sure",
`12` = "Refused")
survey$race2 <- dplyr::recode(survey$Q2035,
`12` = "Decline/not sure",
`11` = "Decline/not sure",
`1` = "Yes, hispanic",
`2` = "No, not hispanic")
table(survey$race1)
table(survey$race2)
survey$race <- ifelse(survey$race1 == "Refused" |
survey$race1 == "Not sure",
"Decline/not sure", ifelse(survey$race1 == "White",
ifelse(survey$race2 == "Decline/not sure",
"Decline/not sure",
ifelse(survey$race2 == "No, not hispanic",
"Non-Hispanic White",
"Hispanic White")), "Non-white"))
table(survey$race)
table(survey$race[survey$race1 == "White"])
# politics (party)
table(survey$Q2020)
survey$party <- dplyr::recode(survey$Q2020,
`1` = "Republican",
`2` = "Democrat",
`3` = "Independent",
`4` = "Other",
`11` = "Not sure",
`12` = "Refused")
table(survey$party)
# politics (ideology)
table(survey$Q2025)
survey$ideology <- dplyr::recode(survey$Q2025,
`1` = "Conservative",
`2` = "Moderate",
`3` = "Liberal",
`11` = "Not sure",
`12` = "Refused")
table(survey$ideology)
# gender
table(survey$Q2060)
survey$gender <- dplyr::recode(survey$Q2060,
`1` = "Male",
`2` = "Female")
table(survey$gender)
# religion
survey$religion <- NA
#factuals
table(survey$Q10)
survey$factual1 <- dplyr::recode(survey$Q10,
`1` = "Aware",
`2` = "Not aware",
`11` = "Don't know")
table(survey$factual1)
survey$factual2 <- NA
survey$factual3 <- NA
## alienation index
survey$dontcare <- dplyr::recode(survey$Q40_A,
`1` = "Feel",
`2` = "Don't Feel",
`11` = "Not Sure",
`12` = "Refused")
survey$dontcount <- dplyr::recode(survey$Q40_C,
`1` = "Feel",
`2` = "Don't Feel",
`11` = "Not Sure",
`12` = "Refused")
survey$leftout <- dplyr::recode(survey$Q40_D,
`1` = "Feel",
`2` = "Don't Feel",
`11` = "Not Sure",
`12` = "Refused")
## question_place
survey$question_place <- "before party"
# subset
survey_718368 <-survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "employed.self", "occupation", "occupation.self", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion",
"factual1", "factual2", "factual3", "dontcare", "dontcount", "leftout",
"question_place")]
summary(survey_718368)
# save file
saveRDS(survey_718368, file = "survey_718368.rds")
setwd("~/Dropbox/Perception_Inequality_wHannah/Replication/Harris_Data/Harris 1997 National Issues Survey, study no. 618199")
require("dplyr")
survey <- read.table("harris_s618199_spss.tab", header = TRUE)
### fix everything below for this survey
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- "618199"
# study year (year)
survey$year <- 1997
# geographic data (urban)
survey$urban <- NA
# geographic data (region)
survey$region <- NA
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
table(survey$E1_2)
survey$inequality <- dplyr::recode(as.character(survey$E1_2),
`1` = "Feel",
`2` = "Don't Feel",
`11` = "Not Sure",
`12` = "Refused")
table(survey$inequality)
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- NA
survey$union.other <- NA
# employment (employed)
survey$employed <- NA
# empl self
table(survey$G3)
survey$employed.self <- dplyr::recode(as.character(survey$G3),
`1` = "Employed full-time",
`2` = "Employed part-time",
`3` = "Unemployed, but looking for work",
`4` = "Not employed and not looking for work",
`11` = "Don't know",
`12` = "Refused")
table(survey$employed)
# occupation
survey$occupation <- NA
# occ self
survey$occupation.self <- NA
# household size (hhsize)
table(survey$F6)
setwd("~/Dropbox/Perception_Inequality_wHannah/Replication/Harris_Data/Harris 1997 National Issues Survey, study no. 618199")
require("dplyr")
survey <- read.table("harris_s618199_spss.tab", header = TRUE)
### fix everything below for this survey
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- "618199"
# study year (year)
survey$year <- 1997
# geographic data (urban)
survey$urban <- NA
# geographic data (region)
survey$region <- NA
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
table(survey$E1_2)
survey$inequality <- dplyr::recode(as.character(survey$E1_2),
`1` = "Feel",
`2` = "Don't Feel",
`11` = "Not Sure",
`12` = "Refused")
table(survey$inequality)
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- NA
survey$union.other <- NA
# employment (employed)
survey$employed <- NA
# empl self
table(survey$G3)
survey$employed.self <- dplyr::recode(as.character(survey$G3),
`1` = "Employed full-time",
`2` = "Employed part-time",
`3` = "Unemployed, but looking for work",
`4` = "Not employed and not looking for work",
`11` = "Don't know",
`12` = "Refused")
table(survey$employed)
# occupation
survey$occupation <- NA
# occ self
survey$occupation.self <- NA
# household size (hhsize)
## this only includes adults voer 18
table(survey$F6)
survey$hhsize <- as.character(survey$F6)
# education (educ)
table(survey$F2)
survey$educ <- dplyr::recode(survey$F2,
`1` = "Less than high school",
`2` = "High school graduate",
`3` = "Some college",
`4` = "College graduate",
`5` = "Post graduate",
`11` = "Not sure",
`12` = "Refused")
table(survey$educ)
# household income (income)
table(survey$F3)
survey$income <- dplyr::recode(survey$F3,
`1` = "Under $7500",
`2` = "$7,501 to $15,000",
`3` = "$15,001 to $25,000",
`4` = "$25,001 to $35,000",
`5` = "$35,001 to $50,000",
`6` = "$50,001 to $75,000",
`7` = "$75,001 to $100,000",
`8` = "$100,001 or over",
`11` = "Not sure",
`12` = "Refused")
table(survey$income)
# age
table(survey$F1)
survey$age <- as.character(survey$F1)
# race
table(survey$F5)
survey$race1 <- dplyr::recode(survey$F5,
`1` = "White",
`2` = "Black",
`3` = "African-American",
`4` = "Asian or Pacific Islander",
`5` = "American Indian or Alaskan native",
`6` = "Some other race",
`11` = "Not sure",
`12` = "Refused")
table(survey$race)
setwd("~/Dropbox/Perception_Inequality_wHannah/Replication/Harris_Data/Harris 1997 National Issues Survey, study no. 618199")
require("dplyr")
survey <- read.table("harris_s618199_spss.tab", header = TRUE)
survey$race### fix everything below for this survey
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- "618199"
# study year (year)
survey$year <- 1997
# geographic data (urban)
survey$urban <- NA
# geographic data (region)
survey$region <- NA
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
table(survey$E1_2)
survey$inequality <- dplyr::recode(as.character(survey$E1_2),
`1` = "Feel",
`2` = "Don't Feel",
`11` = "Not Sure",
`12` = "Refused")
table(survey$inequality)
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- NA
survey$union.other <- NA
# employment (employed)
survey$employed <- NA
# empl self
table(survey$G3)
survey$employed.self <- dplyr::recode(as.character(survey$G3),
`1` = "Employed full-time",
`2` = "Employed part-time",
`3` = "Unemployed, but looking for work",
`4` = "Not employed and not looking for work",
`11` = "Don't know",
`12` = "Refused")
table(survey$employed)
# occupation
survey$occupation <- NA
# occ self
survey$occupation.self <- NA
# household size (hhsize)
## this only includes adults voer 18
table(survey$F6)
survey$hhsize <- as.character(survey$F6)
# education (educ)
table(survey$F2)
survey$educ <- dplyr::recode(survey$F2,
`1` = "Less than high school",
`2` = "High school graduate",
`3` = "Some college",
`4` = "College graduate",
`5` = "Post graduate",
`11` = "Not sure",
`12` = "Refused")
table(survey$educ)
# household income (income)
table(survey$F3)
survey$income <- dplyr::recode(survey$F3,
`1` = "Under $7500",
`2` = "$7,501 to $15,000",
`3` = "$15,001 to $25,000",
`4` = "$25,001 to $35,000",
`5` = "$35,001 to $50,000",
`6` = "$50,001 to $75,000",
`7` = "$75,001 to $100,000",
`8` = "$100,001 or over",
`11` = "Not sure",
`12` = "Refused")
table(survey$income)
# age
table(survey$F1)
survey$age <- as.character(survey$F1)
# race
table(survey$F5)
survey$race1 <- dplyr::recode(survey$F5,
`1` = "White",
`2` = "Black",
`3` = "African-American",
`4` = "Asian or Pacific Islander",
`5` = "American Indian or Alaskan native",
`6` = "Some other race",
`11` = "Not sure",
`12` = "Refused")
table(survey$race)
setwd("~/Dropbox/Perception_Inequality_wHannah/Replication/Harris_Data/Harris 1997 National Issues Survey, study no. 618199")
require("dplyr")
survey <- read.table("harris_s618199_spss.tab", header = TRUE)
### fix everything below for this survey
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- "618199"
# study year (year)
survey$year <- 1997
# geographic data (urban)
survey$urban <- NA
# geographic data (region)
survey$region <- NA
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
table(survey$E1_2)
survey$inequality <- dplyr::recode(as.character(survey$E1_2),
`1` = "Feel",
`2` = "Don't Feel",
`11` = "Not Sure",
`12` = "Refused")
table(survey$inequality)
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- NA
survey$union.other <- NA
# employment (employed)
survey$employed <- NA
# empl self
table(survey$G3)
survey$employed.self <- dplyr::recode(as.character(survey$G3),
`1` = "Employed full-time",
`2` = "Employed part-time",
`3` = "Unemployed, but looking for work",
`4` = "Not employed and not looking for work",
`11` = "Don't know",
`12` = "Refused")
table(survey$employed)
# occupation
survey$occupation <- NA
# occ self
survey$occupation.self <- NA
# household size (hhsize)
## this only includes adults voer 18
table(survey$F6)
survey$hhsize <- as.character(survey$F6)
# education (educ)
table(survey$F2)
survey$educ <- dplyr::recode(survey$F2,
`1` = "Less than high school",
`2` = "High school graduate",
`3` = "Some college",
`4` = "College graduate",
`5` = "Post graduate",
`11` = "Not sure",
`12` = "Refused")
table(survey$educ)
# household income (income)
table(survey$F3)
survey$income <- dplyr::recode(survey$F3,
`1` = "Under $7500",
`2` = "$7,501 to $15,000",
`3` = "$15,001 to $25,000",
`4` = "$25,001 to $35,000",
`5` = "$35,001 to $50,000",
`6` = "$50,001 to $75,000",
`7` = "$75,001 to $100,000",
`8` = "$100,001 or over",
`11` = "Not sure",
`12` = "Refused")
table(survey$income)
# age
table(survey$F1)
survey$age <- as.character(survey$F1)
# race
table(survey$F5)
survey$race
survey$race1 <- dplyr::recode(survey$F5,
`1` = "White",
`2` = "Black",
`3` = "African-American",
`4` = "Asian or Pacific Islander",
`5` = "American Indian or Alaskan native",
`6` = "Some other race",
`11` = "Not sure",
`12` = "Refused")
table(survey$race)
table(survey$race1)
